package com.fl.sliderverification.dialog

import android.content.Context
import android.view.View
import android.widget.SeekBar
import android.widget.Toast
import com.fl.sliderverification.R
import com.fl.sliderview.SliderVerificationView
import com.lxj.xpopup.core.CenterPopupView
import kotlinx.android.synthetic.main.dialog_captcha_security_layout.view.*

/**
 * Captcha
 */
class CaptchaSecurityDialog(context: Context) : CenterPopupView(context) {

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_captcha_security_layout
    }

    override fun onCreate() {
        super.onCreate()

        mSvv.setOnVerificationResultListener(object :
            SliderVerificationView.OnVerificationResultListener {
            override fun onVerificationSuccess(slideDuration: Long) {
                Toast.makeText(context, "成功--使用时间:${slideDuration}毫秒", Toast.LENGTH_SHORT).show()
            }

            override fun onVerificationError(slideDuration: Long) {
                Toast.makeText(context, "失败--使用时间:${slideDuration}毫秒", Toast.LENGTH_SHORT).show()
            }

        })
    }
}